import React, { useState, useEffect } from 'react';
import { View } from 'react-native';
import { Toast } from '@ant-design/react-native';
import AcceptanceView from '../../components/AcceptanceView';
import { selectPlan } from '../../comconfig/sqlfun';

const Acceptance = () => {
    const [accList, setAccList] = useState([]);
    const getPlanList = async () => {
        try {
            const list = await selectPlan(3, '');
            const arr = [];
            for (let i = 0; i < list.length; i += 1) {
                arr.push(JSON.parse(list[i]));
            }
            setAccList(arr);
        } catch (error) {
            Toast.info('获取数据失败', 1, undefined, false);
        }
    };
    useEffect(() => {
        getPlanList();
    }, []);
    return (
        <View>
            <AcceptanceView accList={accList} getPlanList={getPlanList} />
        </View>
    );
};

export default Acceptance;
